#!/usr/bin/perl

use File::Basename;

#append '/' to the incoming dir path if it doesn't have it.
#Ex. "/a/b" will become "/a/b/". 
sub getStdDirPath
{
	my $lastChar = chop($_[0]);
	if ($lastChar ne '/')
	{
		$lastChar .= '/';
	}
	
	$_[0] .= $lastChar;
	return $_[0];
}

my $dir = "/a/b";
my $newDir = getStdDirPath($dir);
print $dir . "\n";
print $newDir . "\n";

$dir = "/a/b/";
getStdDirPath($dir);
print $dir . "\n"; 